<include file="Public/head" />
<style type="text/css">
    .bond-jinger ul li{width: 156px;margin-left: 0px;}
    .bond-jinger ul li:first-child{width: 156px;margin-left: 20px;}
</style>
</head>
<body>
  <include file="Public/common_header" />

  <div class="mian">
    <include file="Public/sidebar" menu='cwgl.bzjgl' />
    <div class="mianR">
      <div class="yuyue bond">
        <ul>
          <li class="yuCurrent">保证金使用情况</li>
          <li>历史记录查询</li>
          <li>车商基本信息</li>
        </ul>
      </div>
      <div class="bond-chongzhi">
   <!--      <?php if($recharge_auth===true):?>
            <input type="button" value="保证金充值" />
        <?php endif;?> -->
      </div>
      <div class="listBox">
          <div class="yuList">

          </div>

        <div class="yuList" style="display:none;">
          <form action="" id='his_fm' >
            <div class="not-biaodan">
              <div class="zhuang-tai zhuang-tai1">
                <input type="text" name="use_time" value="请选择获取时间" value="" id="demoText2" class="end-time" readonly />
              </div>
              <input id="use_type" name="use_type" type="hidden" value=""  />          
              <div class="zhuang-tai">
                <input type="text" value="请选择交易类型" readonly />          
                <dl>
                  <dd onclick="$('#use_type').val('');">取消选择</dd>
                  <foreach name="use_type" item="type" >
                    <dd onclick="$('#use_type').val({$key});">{$type}</dd>
                  </foreach>
                </dl>
              </div>
              <div class="shangSou">
                <input type="button" onclick="ajax_ob.get(1);return false;" value="搜索" />          
              </div>
            </div>
          </form>
          <div class="notused bondconter1">
          </div>
        </div>
        <div class="yuList" style="display:none;">

        </div>
      </div>
      <div class="yongBtn1">
        <input type="submit" onclick="window.close();" value="关闭" class="quxiao" />
      </div>
        
      <!--上拍弹出窗口-->
      <div class="yunBei" style="display:none"></div>
          <form id="add_fm">
              <div class="tanShang tanShang6" style="display:none">
                  <h3>保证金充值</h3>
                  <ul class="daiJingW">
                      <li class="cardealer-zhanghao">
                          <span>
                              车商账号： <em>{$info.user_name}</em>
                          </span>
                          <span>
                              车商联系人： <em>{$info.contact_person}</em>
                          </span>
                      </li>
                      <li class="clearfix">
                          <span>充值金额：</span>
                          <input type="text" name="price" onclick="if(this.value=='请输入金额')this.value='';" value="请输入金额" />          
                          <em>元</em>
                      </li>
                      <li class="clearfix">
                          <input type="button" value="确定" class="queding" />          
                          <input type="button" value="取消" class="quxiao" />          
                      </li>
                  </ul>
              </div>
          </form>
      <!--您已上拍成功-->
      <!--您已上拍成功结束-->
    </div>
    <div class="clear"></div>
  </div>


<script>
var ajax_ob = (function(){
    var dealer_id = '{$Think.get.dealer_id}';

    function get(t,post_data){
          var posts=[
              '/Bail/bailStatus/dealer_id/'+dealer_id,
              '/Bail/his_log/dealer_id/'+dealer_id,
              '/Bail/base_info/dealer_id/'+dealer_id,
              '/Bail/add_price/dealer_id/'+dealer_id
          ];
          if(post_data==undefined){
                post_data = {};
          }
          if(t==1){
            post_data['use_time'] = $('#demoText2').val();
            post_data['use_type'] = $('#use_type').val();
          }
          post_data['dealer_id'] = dealer_id;          
          var url = (post_data['url']?post_data['url']:posts[t]);
          if(url==location.href) return false;
          post_data['url'] = undefined;
          $.post(url,post_data,function(data){
                if(data.code!=200){
                    delay_alert(data.msg,300);
                    return false;
                }
                switch (t) {
                   case 1 :
                        $('.listBox .yuList').eq(t).find('.bondconter1').replaceWith(data.data);
                        break;
                   case 3 :
                        try{
                            if(data.code==200){
                                delay_alert('充值成功!',300);
                                setTimeout(function(){window.location.reload();},400);
                            }else{
                                delay_alert(data.msg,300);
                            }
                        }catch(e){
                             delay_alert('充值失败!',300);
                        }                        
                        break;
                   default :
                       $('.listBox .yuList').eq(t).replaceWith(data.data);
                }
          },'json');
    };

    function init(){
        $('.yuyue ul li').click(function(){        
            get($(this).index(),{dealer_id:dealer_id});
        });

        $('.bond-chongzhi input').click(function(){
            $('.yunBei,.tanShang').show();
        });
        $('#add_fm .queding').click(function(){
            get(3,$('#add_fm').serialize());
        });

        get(0);
    }

    init();

    return {get:get};
})();
</script>


<include file="Public/foot" />

